import { Store } from '@/utils/initStore';
import { Pinia } from 'pinia';
console.log(Store, '    sStore index ');

interface StoreType extends Pinia {
  _s?: Map<string, any>;
}
export function getStore(id?: string) {
  console.log(Store, ' Store ');
  const storeItem = Store as Pinia;
  return id && storeItem.state.value[id]
    ? storeItem.state.value[id]
    : storeItem.state.value;
}
export function setStore(id: string, value: { [propName: string]: any }) {
  const data: StoreType = Store as Pinia;
  const storeItem = data._s?.get(id);
  if (storeItem) {
    storeItem.$patch(value);
  }
}
